package com.ace3l.legal.backend.web;

import java.util.regex.Pattern;

/**
 * Created by IntelliJ IDEA.
 * User: ageer
 * Date: Jul 26, 2008
 * Time: 7:20:13 AM
 * To change this template use File | Settings | File Templates.
 */
public class SimpleRequestParser {
    static Pattern moduleRequest = Pattern.compile("^/(homeportal|studentportal|lawfirmportal|adminportal)/[A-Za-z0-9_]+/[A-Za-z0-9./]*$");
    static Pattern serviceRequest = Pattern.compile("^/(UserService|ProjectService|MailingListService|StudentPortalService|AdminPortalService|LawFirmPortalService)$");

    public static Boolean isModuleRequest(String r) {
        return moduleRequest.matcher(r).matches();
    }


    public static Boolean isServiceRequest(String r) {
        return serviceRequest.matcher(r).matches();
    }
    public static String getModule(String request) {
        String[] s = request.split("/");
        return s[1];
    }
}
